<template>
  <div class="list">
    <el-form class="oldIndent_nav" ref="dataForm" style="margin-bottom:20px;">
      <div style="margin-bottom:20px;padding-top:10px;">
        <span style="margin-left:50px">日期:</span>
        <el-date-picker
          type="date"
          placeholder="选择时间"
          format="yyyy 年 MM 月 dd 日"
          :picker-options="pickerOptions0"
          value-format="yyyyMMdd"
        ></el-date-picker>
        <span style="margin-left:60px">姓名：</span>
        <el-input placeholder="请输入姓名" style="width:200px"></el-input>
        <span style="margin-left:60px">身份证：</span>
        <el-input placeholder="请输入身份证" style="width:200px"></el-input>
        <span style="margin-left:60px">体检套餐：</span>
        <el-cascader :options="options" clearable></el-cascader>
      </div>
      <el-button type="primary" round style="float:right;margin-right:200px">查询</el-button>
      <el-button class="add" type="primary" style="float:left;margin:12px;" @click="creat">添加一条</el-button>
    </el-form>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="preid" align="center" label="预约编号"></el-table-column>
      <el-table-column prop="date" align="center" label="预约时间"></el-table-column>
      <el-table-column prop="name" align="center" label="姓名"></el-table-column>
      <el-table-column prop="phoneNum" align="center" label="联系方式"></el-table-column>
      <el-table-column prop="sex" align="center" label="性别"></el-table-column>
      <el-table-column prop="certNum" width="220" align="center" label="身份证"></el-table-column>
      <el-table-column prop="item" align="center" label="体检套餐"></el-table-column>
      <el-table-column prop="state" align="center" label="订单状态"></el-table-column>
      <el-table-column prop="beizhu" align="center" label="备注"></el-table-column>
      <el-table-column label="操作" width="200" align="center">
        <template slot-scope="scope">
          <el-button
            size="mini"
            v-show="scope.row.state==='待检查'? true: false"
            type="success"
            @click="agree(scope.row)"
          >接受订单</el-button>
          <el-button size="mini" type="danger" v-show="scope.row.state==='待检查'? true: false">取消订单</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 接受订单 -->
    <el-dialog :visible.sync="tableda">
      <el-form
        ref="dataForm"
        label-position="left"
        label-width="70px"
        style="width: 400px; margin-left:50px;"
      >
        <el-form-item label="订单号:">
          <span>{{id}}</span>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="tableda = false">取消</el-button>
        <el-button type="primary" @click="tableda = false">确定接受</el-button>
      </div>
    </el-dialog>
    <!-- 修改一条 -->
    <el-dialog :visible.sync="dialogFormVisible">
      <el-form
        ref="dataForm"
        label-position="left"
        label-width="100px"
        style="width: 400px; margin-left:50px;"
      >
        <el-form-item label="姓名:">
          <el-input />
        </el-form-item>
        <el-form-item label="联系方式:">
          <el-input />
        </el-form-item>
        <el-form-item label="身份证:">
          <el-input />
        </el-form-item>
        <el-form-item label="套餐选择:">
          <el-cascader :options="options" clearable></el-cascader>
        </el-form-item>

        <el-form-item label="预约编号:">
          <el-input />
        </el-form-item>
        <el-form-item label="时间:">
          <el-date-picker
            type="date"
            placeholder="选择时间"
            format="yyyy 年 MM 月 dd 日"
            :picker-options="pickerOptions0"
            value-format="yyyyMMdd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="操作员编号:">
          <el-input />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">新增</el-button>
      </div>
    </el-dialog>
    <!-- 分页 -->
    <el-col :span="24" class="toolbar" style="text-align: center;">
      <el-pagination
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-count="pageNum"
        :page-size="pagesize"
        style="margin-top:30px;margin-bottom:30px"
        layout="total, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </el-col>
  </div>
</template>
<script>
export default {
  data() {
    return {
      id: "",
      tableda: false,
      dialogFormVisible: false,
      currentPage: 1, // 初始页
      pagesize: 10, // 当前页面内的列表行数
      pageCount: 1,
      pageNum: 1, // 页数
      total: 4,
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;
        }
      },
      options: [
        {
          value: "1",
          label: "男士",
          children: [
            {
              value: "one",
              label: "男士至尊护航检查套餐"
            },
            {
              value: "two",
              label: "男士系统深度检查套餐"
            },
            {
              value: "three",
              label: "男士臻爱精选检查套餐"
            },
            {
              value: "four",
              label: "男士优享定制检查套餐"
            }
          ]
        },
        {
          value: "2",
          label: "女士",
          children: [
            {
              value: "one",
              label: "女士至尊护航检查套餐"
            },
            {
              value: "two",
              label: "女士系统深度检查套餐"
            },
            {
              value: "three",
              label: "女士(已婚)臻爱精选检查套餐"
            },
            {
              value: "six",
              label: "女士(未婚)臻爱精选检查套餐"
            },
            {
              value: "four",
              label: "女士(未婚)优享定制检查套餐"
            },
            {
              value: "five",
              label: "女士(已婚)优享定制检查套餐"
            }
          ]
        }
      ],
      value: "0",
      tableData: [
        {
          preid: "54564212",
          seqNum: "456123",
          mrn: "5645612348456523",
          pbCode: "45645612",
          date: "2019-12-11 08:30",
          name: "张三",
          phoneNum: "13456559464",
          timePart: "上午",
          empid: "515",
          active: "MR平扫绿通",
          platform: "dabay",
          certNum: "154235456135121252",
          item: "男士至尊护航检查套餐",
          sex: "男",
          beizhu: "无",
          state: "检查中"
        },
        {
          preid: "456456",
          seqNum: "54123123",
          mrn: "1166545121233",
          pbCode: "456231",
          date: "2019-12-11 14:20",
          active: "便携睡眠呼吸监测",
          name: "张网",
          phoneNum: "15675122421",
          timePart: "下午",
          empid: "151",
          platform: "dabay",
          certNum: "154235456135121252",
          item: "男士系统深度检查套餐",
          sex: "男",
          beizhu: "无",
          state: "待检查"
        },
        {
          preid: "8756123",
          seqNum: "45645",
          mrn: "45645123124652",
          pbCode: "45612123",
          date: "2019-12-12 10:40",
          name: "李现",
          phoneNum: "17812238523",
          timePart: "上午",
          empid: "515",
          active: "专家绿通看诊",
          platform: "dabay",
          certNum: "154235456135121252",
          item: "男士臻爱精选检查套餐",
          sex: "男",
          beizhu: "无",
          state: "待检查"
        },
        {
          preid: "4562121121",
          seqNum: "65451",
          mrn: "845523123456123123",
          pbCode: "514532",
          date: "2019-12-12 15:10",
          name: "王也",
          phoneNum: "13484231234",
          timePart: "下午",
          active: "大咖门诊绿通",
          empid: "515",
          platform: "dabay",
          certNum: "154235456135121252",
          item: "男士优享定制检查套餐",
          sex: "男",
          state: "待检查",
          beizhu: "无"
        }
      ]
    };
  },
  methods: {
    agree(row) {
      this.tableda = true;
      this.id = row.preid;
    },
    creat() {
      this.dialogFormVisible = true;
    },
    //当前页
    handleSizeChange: function(pagesize) {
      this.pagesize = pagesize;
    },
    // 换页：更新列表数据
    handleCurrentChange: function(currentPage) {
      this.currentPage = currentPage;
    }
  },
  mounted() {}
};
</script>
<style lang="scss" scoped>
.list {
  margin-top: 55px;
}
</style>